package com.misyi.util;

import lombok.extern.log4j.Log4j2;

/**
 * 日志工具
 *
 * @author licong
 * @date 2022-12-21 22:14
 */
@Log4j2
public class LogUtil {

    private LogUtil() {
        step = 1;
        current = System.currentTimeMillis();
    }

    public static LogUtil getInstance() {
        return new LogUtil();
    }

    private int step;

    private long current;

    /**
     * 标记当前操作的时间
     *
     * @param operate 操作
     */
    public void mark(String operate) {
        long markCurrent = System.currentTimeMillis();
        log.info("第 " + step + " 步，" + operate + "。用时：" + (markCurrent - current));
        current = markCurrent;
        step++;
    }

}
